<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>扩展运算符 ****</title>
</head>
<body>
    <script>
        //扩展运算符其实是 rest 参数的逆运算  ...
        //数组的展开    扩展运算符可以将数组转为『逗号』分割的参数序列  ES6
        function add(){
            console.log(arguments);
        }
        //声明一个数组
        let arr = ['西游记','红楼梦','三国演义','水浒传'];
        // ...arr   =>  '西游记','红楼梦','三国演义','水浒传'
        add(...arr); // add('西游记','红楼梦','三国演义','水浒传')

        let arr2 = [1,2,3];
        let arr3 = [4,5,6];

        //合并数组
        // let result = arr2.concat(arr3);
        // console.log(result);
        // //          1,2,3 , 4,5,6
        // let res = [...arr2, ...arr3];
        // console.log(res);

        //对象的展开      ES9
        let skillOne = {
            q: '天音波',
            f: '闪现'
        };

        let skillTwo = {
            w: '金钟罩'
        };

        let skillThree = {
            e: '天雷破'
        };

        let skillFour = {
            r: '猛龙摆位'
        };

        let liqing = {
            ...skillOne,
            ...skillTwo,
            ...skillThree,
            ...skillFour
        };

        console.log(liqing);

        // ...skillOne   =>  q: '天音波', f: '闪现'
       
    </script>
    
</body>
</html>